package org.zsl.service;


import org.zsl.model.ResponseMsg;
import org.zsl.model.User;

import java.util.ArrayList;
import java.util.List;

public class UserService {


     public Boolean login(User user){

         if(user.getUsername().equals("admin")
                 &&user.getPassword().equals("123")){

             return  true;
         }
         return  false;
     }


     public ResponseMsg login2(User user){

          ResponseMsg responseMsg = new ResponseMsg();
          responseMsg.setSuccess(false);

         if(user.getUsername().equals("admin")
                 &&user.getPassword().equals("123")){
               responseMsg.setSuccess(true);
         }

         return  responseMsg;
     }


     public List<User> getList(){

         List<User> list = new ArrayList<>();
         User user1 = new User();
         user1.setUsername("admin");
         user1.setPassword("123");

         User user2 = new User();
         user2.setUsername("test");
         user2.setPassword("123");

         User user3 = new User();
         user3.setUsername("test002");
         user3.setPassword("123");

         list.add(user1);
         list.add(user2);
         list.add(user3);

         return list;
     }
}
